<?php
 include "counter2.php";

pagestart();
print "<html>";
pagehead(_("Times of last login"));
print "<BODY bgcolor=\"white\">\n";
pagetop(_("Times of last login"));
print _("The counter times out entries if they have not been accessed for two years, or after one year if the email goes bad.") .
"\n<p>\n";

	$lastworthbothering = strftime("%Y-%m-01 00:00:00",
				time() - 60*60*24*30*10); # 10 months

print _("This table gives the age of entries currently in the database and in states \"OK\" or \"Bad\" and ages older than ") . $lastworthbothering . "." .

"\n<table border>\n";
        
	$sql = "select substring(logintime, 1, 7) as m, count(*) from users where (users.state = 'ok' or users.state = 'bad') and logintime < '$lastworthbothering' group by m";

        $placeq = mysql_query($sql);
        while ( $place = mysql_fetch_array($placeq)) {
	    print("<tr><td>" . $place[0] . "</td><td>" . $place[1] . "</td></tr>\n");
        }

print "</table>\n";

pagebottom();
print "\n</body>\n</html>";
?>
